

object SeqPractice extends App {

  //indexeSeq
  val indexedSeq = IndexedSeq(1, 2, 3)
  assert(indexedSeq.head == 1)
  assert(indexedSeq.last == 3)
  assert(indexedSeq.isEmpty == false)

  val indexedSeqTwo = IndexedSeq()
  assert(indexedSeqTwo.headOption == None)
  println(indexedSeqTwo.headOption)
}


object MapPractice extends App {
  val indexedSeq = IndexedSeq(1, 2, 3)
  println(indexedSeq.dropWhile(p => p == 1))
  println(indexedSeq.drop(2))


}


object ListPractice extends App {
  val list01 = List(1, 2, 3, 4, 5)
  val list02 = List(1, 2, 3, 4)

  //https://www.jianshu.com/p/fa2ed7ed391e
  println(list01 collect { case (count) => count + 1 })

  def isTowDouble(num: Int): Boolean = if (num % 2 == 0) true else false

  println(list01 count isTowDouble)

  println(list01 diff list02) //前者和后者不同的元素


}